var flag=false;
$(function(){
	$.post(root+'/wxa/jsapi',{'url':location.href},function(data){
		wx.config({
		    debug: false, 
		    appId: data.appId, 
		    timestamp: data.timestamp, 
		    nonceStr: data.nonceStr, 
		    signature: data.signature,
		    jsApiList: [
		                'checkJsApi',
		                'onMenuShareTimeline',
		                'onMenuShareAppMessage',
		                'onMenuShareQQ',
		                'onMenuShareWeibo',
		                'onMenuShareQZone',
		                'hideMenuItems',
		                'showMenuItems',
		                'hideAllNonBaseMenuItem',
		                'showAllNonBaseMenuItem',
		                'translateVoice',
		                'startRecord',
		                'stopRecord',
		                'onVoiceRecordEnd',
		                'playVoice',
		                'onVoicePlayEnd',
		                'pauseVoice',
		                'stopVoice',
		                'uploadVoice',
		                'downloadVoice',
		                'chooseImage',
		                'previewImage',
		                'uploadImage',
		                'downloadImage',
		                'getNetworkType',
		                'openLocation',
		                'getLocation',
		                'hideOptionMenu',
		                'showOptionMenu',
		                'closeWindow',
		                'scanQRCode',
		                'chooseWXPay',
		                'openProductSpecificView',
		                'addCard',
		                'chooseCard',
		                'openCard'
			              ]
			});
		});
	var Mdialog=function(title,msg,btl,btr,btlfn,btrfn){
		var html='<div class="ui-dialog">';
		html+='<div class="ui-dialog-cnt">';
		html+='<header class="ui-dialog-hd ui-border-b">';
		html+='<h3 id="dialog_title">'+title+'</h3>';
		html+='</header>';
		html+='<div class="ui-dialog-bd">';
		html+=msg
		html+='</div>';
		html+='<div class="ui-dialog-ft">';
		html+='<button type="button" id="btn2">'+btr+'</button>';
		html+='<button type="button" id="btn1" data-role="button">'+btr+'</button>';
		html+='</div>';
		html+='</div>';
		html+='</div>';
		function show(){
			$(html).append($(document.body));
			$(".ui-dialog").dialog("show");
		}
		function show(){
			btlfn();
		}
	}
	
});

